package com.deyinet.bdcms.tools;

import com.deyinet.bdcms.controller.dtoandapi.RedisDeviceApi;
import com.deyinet.bdcms.entity.Device;

/**
 * Created by Administrator on 2017/10/16 0016.
 */
public class DeviceToRedisObj {
    public static RedisDeviceApi transform(Device device, RedisDeviceApi api){
        api.setDeviceName(device.getDevicename());
        api.setUpper(device.getUpper());
        api.setLower(device.getLower());
        api.setLocation(device.getLocation());
        api.setDeviceModel(device.getDevicemodel());
        api.setLat(device.getLat());
        api.setSampleCycle(device.getSampleCycle());
        api.setLng(device.getLng());
        api.setImei(device.getImei());
        api.setImsi(device.getImsi());
        api.setReportCycle(device.getReportCycle());
        api.setDeviceCreateTime(device.getCreatedate());
        api.setDeviceInfo(device.getDeviceinfo());

        if (device.getDeviceownerByOwnerid()!=null) {
            api.setDeviceOwner(device.getDeviceownerByOwnerid().getName());
        }
        return api;
    }
}
